<%@page import="org.jcms.model.Book"%>
<%@page import="org.jcms.service.BookServiceI"%>
<%@page
	import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.context.ApplicationContext"%>
<%@ page language="java" pageEncoding="UTF-8"%>

<%
	String ISBN = request.getParameter("ISBN");
	if (ISBN == null) {
		out.print("参数错误");
		return;
	}
	ApplicationContext ac = WebApplicationContextUtils
			.getRequiredWebApplicationContext(this.getServletContext());

	BookServiceI bookServiceI = (BookServiceI) ac
			.getBean("bookServiceImpl");

	Book book = bookServiceI.findById(ISBN);

	if (book == null) {
		out.print("此书不存在");
		return;
	}

	java.text.NumberFormat nf = java.text.NumberFormat.getInstance();
	nf.setGroupingUsed(false);
%>
<script type="text/javascript">
	function mySubmit() {
		if ($('#submitForm22').form('validate') != true) {
			return;
		}
		AjaxFormSubmit("../CustomerShoppingCartManage.do",

		"ajaxImg",

		"submitForm22",

		function(msg) {

			showAlert("操作成功", "操作成功!购物车现在有" + msg + "条记录");
			$('#win').window('close');
			$("#shoppingcart").text("购物车(" + msg + ")");
		},

		function(msg) {
			showAlert("操作失败", msg);
		}

		);
	}
</script>
</head>
<form id="submitForm22">
	<div style="text-align: center;">
		<input type="hidden" name="type" value="0" />
		<table>
			<tr>
				<td colspan="2" height="50px">添加到购物车</td>
			</tr>
			<tr>
				<td>*ISBN:</td>
				<td><%=ISBN%><input type="hidden" name="bookIsbn"
					value="<%=ISBN%>" />
				</td>
			</tr>

			<tr>
				<td>书名:</td>
				<td><%=book.getBookName()%></td>
			</tr>



			<tr>
				<td>数量:</td>
				<td><input type="text" maxlength="5" id="addNumber"
					name="addNumber" value="" class="easyui-validatebox"
					data-options="required:true,missingMessage:'不能为空'" /></td>
			</tr>

			<tr>
				<td colspan="2" style="text-align: center;"><input
					type="button" value="提交" onclick="mySubmit()" />
				</td>

			</tr>

		</table>

		<img src="../../images/loading.gif"
			style="display: none; height: 25px; width: 25px;" id="ajaxImg" />
	</div>
</form>
</body>
</html>



